<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <script>
        async function fun1() {
            // return 10
            // return Promise.reject('fail')
            return Promise.resolve('success')
            
        }

        let promise = fun1()

        async function fun2() {
            let res = ''
            try {
                res = await promise
            } catch (error) {
                console.log('error' + error)
            }
            console.log('结果为：' + res)
        }

        fun2()

    </script>
</head>
<body>
</body>
</html>